[

    async function( kuo,Context,context){
        Context.headers["content-type"] = 'application/json; charset=UTF-8';
        let $THIS = this;
        let LANG = this.LANG();
        let $DATA = Object.assign({},this.$DATA);
        let  $features = await Kuoplus(kuo.class);
        let $AC = kuo.Path['1']?kuo.Path['1']:"get";
        let $MM = kuo.Path['0']?kuo.Path['0']:"";
        let $CJMM = $features['configure']['采集密码']?$features['configure']['采集密码']['0']:"";
        if($CJMM == "" || $MM != $CJMM){
            $DATA.code = -1;
            $DATA.msg = "Pass Error";
            Context.body = json_encode($DATA);
            return ;
        }
        $DATA.code = 1;
        if($AC == 'get'){
            let $db = await db('cms_type');
            $DATA.data = await $db.Zhicha('id,name,subclass').Select();
        }else if($AC == 'add'){
            let $_POST = kuo.post;
            if(!isset($_POST['name']) ||  $_POST['name'] == ""){
                $DATA.code = -1;
                $DATA.msg = "name Error";
                Context.body = json_encode($DATA);
                return ;
            }
            let $db = await db('cms_content');
            let $gengurl = false;
            if(! isset($_POST['url']) || $_POST['url'] == "" ){
                $gengurl = true;
            }else {
                let $fanx = $THIS.ADMIN_FINDURL($_POST['url']);
                if(!$fanx){
                    $gengurl = true;
                }
            }

            if(!isset($_POST['atime'])){
                $_POST['atime'] = $_POST['xtime'] = Mode("Tools").Time();
            }
            let cunzaide =  await  $db.Where({'url':$_POST['url']}).Find();
            let upfanui =false;
            if(cunzaide){
                upfanui =   await  $db.Where({'id':cunzaide['id']}).Update($_POST);
            }
            if(!upfanui){
                let $fanjie = await $db.Insert($_POST);
                if( $fanjie){
                    if($gengurl){
                        $_POST['url'] = ($features['configure']['默认前缀']?$features['configure']['默认前缀']['1']: "" )+$fanjie;
                        let $fanx = $THIS.ADMIN_FINDURL( $_POST['url'] );
                        if(!$fanx){
                            $_POST['url']  = 'content_'+$fanjie;
                        }
                        $db.Where({'id':$fanjie}).Update( {'url':$_POST['url'] });
                    }
                    $DATA.data = $fanjie;
                }else{
                    $DATA.code = -1;
                    $DATA.data = $_POST['name'];
                }
            }else{
                $DATA.data = cunzaide['id'];
            }
        }
        Context.body = json_encode($DATA);
    }

]